$(function () {
   $("#btn_search").click(function () {
       let form = this.form;
       console.log(form);
       form.submit();
   });

    $("#btn_del_batch").click(function () {
        //判断是否有勾选要删除的记录
        let ids = [];
        $("input[name='cb_select']:checked").each(function (index, item) {
            ids.push(item.value);
        })
        if (ids.length > 0) {
            let r = confirm("是否删除选中记录?");
            if (r) {
                location.href = "/book/delBatch.do?ids=" + ids;
            }
        }
    });

    $(".btn-del").click(function () {
        let href = $(this).attr("data-href");
        let r = confirm("是否删除选中记录?");
        if (r) {
            location.href = href;
        }
    });

    $("#btn_add").click(function () {
        location.href = "/book/add.html";
    });
});